import type {APIActions} from './types'

function CreateActions(prefix, suffix): APIActions {
  const PREFIX = prefix.toUpperCase();
  const SUFFIX = suffix.toUpperCase();
  return {
    REQUEST: `${PREFIX}/${SUFFIX}_REQUEST`,
    SUCCESS: `${PREFIX}/${SUFFIX}_SUCCESS`,
    FAILURE: `${PREFIX}/${SUFFIX}_FAILURE`,
    ADD: `${PREFIX}/${SUFFIX}_ADD_SUCCESS`,
  };
}

export const ADD_ENTITIES = 'ADD_ENTITIES';


export const LOG_IN_SUCCESS = 'LOG_IN_SUCCESS'
export const LOG_OUT_SUCCESS = 'LOG_OUT_SUCCESS'
export const USER_INFO_SUCCESS = 'USER_INFO_SUCCESS'

export const TOPICS_ACTIONS = CreateActions('TOPICS', 'FETCH')

export const TOPIC_FETCH_ACTIONS = CreateActions('TOPIC', 'FETCH')

export const CHANNELS_ACTIONS = CreateActions('CHANNELS', 'FETCH')
